<template>
	<view>
		<Recordingtop @tab-change="handleTabChange"></Recordingtop>
		<view>
			<view v-show="currentTab === 'traceability'">
				<Traceability></Traceability>
			</view>
			<view v-show="currentTab === 'healthy'">
				<Healthy></Healthy>
			</view>
			<view v-show="currentTab === 'quarantine'">
				<Quarantine></Quarantine>
			</view>
			<view v-show="currentTab === 'vaccine'">
				<Vaccine></Vaccine>
			</view>
			<view v-show="currentTab === 'reproduction'">
				<Reproduction></Reproduction>
			</view>
		</view>
	</view>
</template>

<script setup>
	import Recordingtop from '@/pages/components/Recordingtop.vue';
	import Traceability from '@/pages/livestock/child/Traceability.vue';
	import Healthy from '@/pages/livestock/child/Healthy.vue';
	import Quarantine from '@/pages/livestock/child/Quarantine.vue';
	import Vaccine from '@/pages/livestock/child/Vaccine.vue';
	import Reproduction from '@/pages/livestock/child/Reproduction.vue';
	import {
		ref,
		onMounted
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	const fId = ref('')

	const currentTab = ref('traceability'); // 默认显示溯源信息

	const handleTabChange = (tabValue) => {
		currentTab.value = tabValue;
	};

	onLoad((options) => {
		if (!options.fId) {
			console.error('未接收到fId参数，当前options:', options)
			uni.showToast({
				title: '参数错误，缺少牲畜ID',
				icon: 'none'
			})
			uni.navigateBack()
			return
		}
		fId.value = options.fId
	})
</script>

<style scoped>
</style>